{include file='public/header' /}
<style type="text/css">
	::-webkit-input-placeholder { /* WebKit browsers */
	    color:    rgba(0,0,0,.5);
	}
	:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
	    color:    rgba(0,0,0,.5);
	}
	::-moz-placeholder { /* Mozilla Firefox 19+ */
	    color:    rgba(0,0,0,.5);
	}
	:-ms-input-placeholder { /* Internet Explorer 10+ */
	    color:    rgba(0,0,0,.5);
	}
	.regmobile{
		width: 94%;
		margin:.4rem auto;
		font-size: .4rem;
		color:rgba(0,0,0,.7);
	}
	html,body{
		width: 100%;
		height: 100%;
	}
</style>
<body class="body">
	<div class="contents">
		<div class="fgheader"><a href="javascript:window.history.go(-1);"><img src="__STATIC__/mobile/images/Return.png"></a>注册</div>
		<div class="submitBox" style="margin-top: 4.6rem;">
			<p class="regmobile" style="color:#fff">手机号注册</p>
			<div class="fgdiv">
				<input type="text" id="username" placeholder="请输入手机号">
				<!-- <span>获取验证码</span> -->
			</div>
			<div class="fgdiv">
				<input type="text" id="nickname" placeholder="请输入姓名">
			</div>
			<!-- <div class="fgdiv">
				<input type="password" id="yzm" placeholder="请输入验证码">
			</div> -->
			<div class="fgdiv">
				<input type="password" id="password" placeholder="请输入密码">
			</div>
			<div class="fgdiv">
				<input type="password" id="passwords" placeholder="确认密码">
			</div>
		</div>
		<div class="logibtn"><span>注册</span></div>
	</div>
	
	<script type="text/javascript">
		//注册账号
		$(function(){
			$('.logibtn').click(function(){
				var username = $('#username').val();
				var nickname = $('#nickname').val();
				var password = $('#password').val();
				var passwords = $('#passwords').val();
				if (username == '' || password == '' || passwords == '' || nickname == '') {
					layer.open({
					    content: '请填写账号密码'
					    ,skin: 'msg'
					    ,time: 2 //2秒后自动关闭
					  });
					return false;
				}
				if (password != passwords) {
					layer.open({
					    content: '两次密码不同'
					    ,skin: 'msg'
					    ,time: 2 //2秒后自动关闭
					  });
					return false;
				}
				$.ajax({
	                url:"{:url('reg')}",
	                type:'post',
	                cache:false,
	                dataType:'JSON',
	                timeout: 10000,
	                data:{
	                	username:username,
	                	nickname:nickname,
	                	password:password,
	                	passwords:passwords
	                },
	                success:function(dete){
	                	if (dete.code == 1) {
				            layer.open({
							    content: dete.msg
							    ,skin: 'msg'
							    ,time: 3 //2秒后自动关闭
							  });
				            window.location.href = dete.url;
	                	}else{
	                		layer.open({
							    content: dete.msg
							    ,skin: 'msg'
							    ,time: 2 //2秒后自动关闭
							  });
	                		// layer.alert(dete.msg, {icon: 2}); 
	                	}
	                    
	                    
	                }
	            })
			});
		})
		
		// fastclick.js组件的引用
		$(function() {
			FastClick.attach(document.body);
		})
	</script>
</body>
</html>